home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cdity
/
ModeProSrc.lha
/
Daemon
/
MPModeNames.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-30
|
3KB
|
119 lines
#include "mp.h"
#include <graphics/displayinfo.h>
ULONG GetMonitorName(ULONG DisplayID, STRPTR Buffer, ULONG BufferLen);
STRPTR GetModeName(ULONG DisplayID)
{
ULONG deflen,
len,
monlen;
UBYTE monname[40];
STRPTR retval=0;
struct NameInfo nameinfo;
STRPTR deflabel;
deflabel=GetString(MSG_OLD_SCREENMODES);
deflen =strlen(deflabel);
deflen =((DisplayID & MONITOR_ID_MASK) ? 0 : deflen);
{
if(GetDisplayInfoData(0,(UBYTE *)&nameinfo,sizeof(nameinfo), DTAG_NAME, DisplayID)>0)
{
if(nameinfo.Name)
{
if(retval=AllocVec(strlen(nameinfo.Name)+1+deflen,MEMF_PUBLIC))
{
if(deflen)
strcpy(retval,deflabel);
strcpy(&retval[deflen], nameinfo.Name);
}
}
}
/* Attempt Monitor: Width x Height */
if(!retval)
{
struct DimensionInfo diminfo;
struct DisplayInfo dispinfo;
if(monlen=GetMonitorName(DisplayID,monname,40))
{
if((GetDisplayInfoData(0,(UBYTE *)&diminfo ,sizeof(diminfo) , DTAG_DIMS, DisplayID)>0) &&
(GetDisplayInfoData(0,(UBYTE *)&dispinfo,sizeof(dispinfo), DTAG_DISP, DisplayID)>0) )
{
len=monlen + deflen + 39 +1;
// "#### x #### AA LACED HAM EHB DUALPF PF2" 39
if(retval=AllocVec(len,MEMF_PUBLIC))
{
if(deflen)
strcpy(retval,deflabel);
sprintf(&retval[deflen],"%s:%4d x %4d",
monname,
(diminfo.Nominal.MaxX+1) & 0xffff,
(diminfo.Nominal.MaxY+1) & 0xffff);
/*
if(dispinfo.PropertyFlags & DIPF_IS_)
strcat(retval,"");
*/
/*
if(dispinfo.PropertyFlags & DIPF_IS_AA)
strcat(retval," AA");
*/
if(dispinfo.PropertyFlags & DIPF_IS_DUALPF)
strcat(retval," DPF");
if(dispinfo.PropertyFlags & DIPF_IS_PF2PRI)
strcat(retval," PF2");
if(dispinfo.PropertyFlags & DIPF_IS_HAM)
strcat(retval," HAM");
if(dispinfo.PropertyFlags & DIPF_IS_EXTRAHALFBRITE)
strcat(retval," EHB");
if(dispinfo.PropertyFlags & DIPF_IS_LACE)
strcat(retval," Laced");
}
}
}
}
/* Last ditch effort, just display the DisplayID in hex */
if(!retval)
if(retval=AllocVec(12,MEMF_PUBLIC))
sprintf(retval,"ID:%8x",DisplayID);
}
return(retval);
}
ULONG GetMonitorName(ULONG DisplayID, STRPTR Buffer, ULONG BufferLen)
{
struct MonitorSpec *monspec;
ULONG rv=0;
if(monspec=OpenMonitor(0,DisplayID & MONITOR_ID_MASK))
{
strncpy(Buffer,monspec->ms_Node.xln_Name,BufferLen);
BufferLen--;
Buffer[BufferLen]=0;
// copy mon name an capitalize
for(rv=0;rv<BufferLen && Buffer[rv]!=0;rv++)
{
Buffer[rv]=ToUpper(Buffer[rv]);
if(Buffer[rv]=='.')
Buffer[rv]=0;
}
Buffer[BufferLen]=0;
CloseMonitor(monspec);
}
return(rv);
}